﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace WOWA.Model.Servers
{
	public class Server
	{
		private ImageSource smallFlag;
		private ImageSource largeFlag;

		public Server()
		{
			this.Localizations = new List<ServerLocalization>();
		}

		public ServerRegionType Region
		{
			get; set;
		}

		public List<ServerLocalization> Localizations
		{
			get;
			private set;
		}

		public ServerLocalization DefaultLocalization
		{
			get
			{
				return Localizations.FirstOrDefault(p => p.IsDefault == true);
			}
		}

		public string Host
		{ 
			get; set; 
		}

		public ImageSource SmallFlag
		{
			get
			{
				if (smallFlag == null)
				{
					smallFlag = new BitmapImage(new Uri("/WOWA.Model;component/Images/flag_" + Region + ".png", UriKind.Absolute));
				}

				return smallFlag;
			}
		}

		public ImageSource LargeFlag
		{
			get
			{
				if (largeFlag == null)
				{
					largeFlag = new BitmapImage(new Uri("/WOWA.Model;component/Images/flag_" + Region + "_large.png", UriKind.Absolute));
				}

				return largeFlag;
			}
		}
	}
}
